<?php

class Logs 
{
	public static function BannerClickLog($key,$email,$referrer,$ip)
	{
		session_start();  
		$time = date("Y-m-d H:i:s");
	
		$str = $time."|".$ip."|".$key."|".$email."|".$referrer ."|".session_id()."\r\n";
		$fileName = "log_".date('YmdH', time());
		
		Logs::WriteLog("Logs",$fileName,$str );
	}
	

	
	
	
	
	
	public static  function WriteLog($fileName,$strLog="",$folderName="logs")
	{
		try
		{	
			Utils::getPath( dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.$folderName);
			$filePath = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.$folderName.DIRECTORY_SEPARATOR.$fileName.".log";
			$fp = fopen($filePath, "a+");
			if (is_writable($filePath)) {
	        	fwrite($fp,$strLog."\r\n"	);
	        }
			fclose($fp);
		
		}
		catch(Exception $ex)
		{
			$ex->getMessage();
		}
	}
	
	
}

?>